/*
 * config.h
 *
 * Created: 07/11/2012 06:12:50
 *  Author: ted
 *  Configuration des pins , IO
 */ 


#ifndef CONFIG_H_
#define CONFIG_H_


// avec internal RC ne pas aller au dessus de 38400bauds !!
//#define USART_BAUDRATE 115200
#define USART_BAUDRATE 500000
//#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)
#define BAUD_PRESCALE ((F_CPU + USART_BAUDRATE * 8L) / (USART_BAUDRATE * 16L) - 1)

/////////////////////////// codeur avance papier Y
#define CODY_A PIND7
#define PINCODY_A PIND
#define DDR_CODY_A DDRD
#define DPCODY_A DDRD7

#define CODY_B PIND6
#define PINCODY_B PIND
#define DDR_CODY_B DDRD
#define DPCODY_B DDRD6

/////////////////////////// codeur X
#define CODX_A PIND3
#define PINCODX_A PIND
#define DDR_CODX_A DDRD
#define DPCODX_A DDRD3

#define CODX_B PIND4
#define PINCODX_B PIND
#define DDR_CODX_B DDRD
#define DPCODX_B DDRD4

/////////////////////////// Moteur L293

#define MOTY_A PINB1 /* timer1 chan A pwm */
#define DDR_MOTY_A DDRB
#define PORT_MOTY_A PORTB
#define DPMOTY_A DDRB1

#define MOTY_B PINC2 /* IO pour sens (+inverting pwm qd change mot) */
#define DDR_MOTY_B DDRC
#define PORT_MOTY_B PORTC
#define DPMOTY_B DDRC2


#define MOTX_A PINB2 /* timer1 chan B pwm */
#define DDR_MOTX_A DDRB
#define PORT_MOTX_A PORTB
#define DPMOTX_A DDRB2

#define MOTX_B PINC3 /* timer1 chan B pwm */
#define DDR_MOTX_B DDRC
#define PORT_MOTX_B PORTC
#define DPMOTX_B DDRC3

///////////////////////////

///////////////////////////  led 2 pins sur un meme port
#define LED_K PORTC1
#define DPLEDK DDRC1

#define LED_A PORTC0
#define DPLEDA DDRC0

#define	PORT_LED PORTC
#define DDR_LED DDRC
///////////////////////////


#endif /* CONFIG_H */
